<!DOCTYPE html>
<html >
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;

    }
    .container{
      width: 100vw;
      height: 100vh;
      /* 设置滚动贴合的方式：沿Y轴 mandatory：强制滚动 */
      scroll-snap-type: y mandatory;
      /* 需要把滚动条设置到父容器，scroll-snap-type才能生效 */
      /* 溢出时，垂直保留、水平隐藏滚动条 */
      overflow-y: scroll;
      overflow-x: hidden;
    }
    .container div{
      width: 100vw;
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      background-color: var(--c);
      font-size: 200px;
      color: #fff;
      /* 设置下一页内容滚动贴合到顶部 */
      scroll-snap-align: start;
    }
  </style>
</head>
<body>
  <div class="container">
    <div style="--c:lightcoral">1</div>
    <div style="--c:lightseagreen">2</div>
    <div style="--c:lightsalmon">3</div>
    <div style="--c:lightskyblue">4</div>
  </div>
</body>
</html>